#ifndef _SOCK_H_
#define _SOCK_H_

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <pthread.h>

#include "message.h"
#include "queue.h"
#include "user.h"

#define BACKLOG 10

userList_t * userList;

typedef struct Server {
    int fd;
    struct sockaddr_in addr;
    int status;
} server_t;

pqueue messageQueue;

server_t openServer(char * addr, int port);
int connectServer(char * addr, int port);

void newConnect(int fd);
void * connectionThread(void * arg);

void * messageThread(void * arg);

#endif
